﻿using Direct.IDAL.User.Jurisdiction;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DirectSell.Model.User;

namespace DirectSell.DAL.User.Jurisdiction
{
    /// <summary>
    /// 位置网格图数据访问层
    /// </summary>
    public class NetworkMapRepository : AbsRepository, INetworkMapRepository
    {
        /// <summary>
        /// 第一层
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public async Task<UserInforMationDetails> QueryFirstFloor(string usercode)
        {
            string sql = string.Format("SELECT * FROM UserInforMations WHERE UserCode='{0}'", usercode);
            var result = await QueryAsync<UserInforMationDetails>(sql.ToString());
            return result.FirstOrDefault();
        }
        /// <summary>
        /// 根据接点向后查询
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="area"></param>
        /// <returns></returns>
        public async Task<UserInforMationDetails> Querybehind(string ContactCode, int area)
        {
            string sql = string.Format("SELECT * FROM UserInforMations WHERE ContactCode='{0}' AND Area={1}", ContactCode,area);
            var result = await QueryAsync<UserInforMationDetails>(sql.ToString());
            return result.FirstOrDefault();
        }

    }
}
